#include"processbar.h"
#include<unistd.h>
typedef void(*callback_t)(int);//函数指针类型：
void download(callback_t cb)
{
  int total  =1000;
  int curr = 0;
  while(curr<=total)
  {
  int rate = (curr*100/total);//算进度
  cb(rate);//通过回调展示进度
  curr+=10;//下载内容更新
  }
}
void init()
{
  memset(s,'\0',sizeof(s));
}
int main()
{
  printf("first download:\n");
  download(processbar);
  init();
  printf("\n");
  printf("first download:\n");
  download(processbar);
  init();
  printf("\n");
  return 0;
}
